﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GLImp;

namespace BoneImp {
	public partial class Skeleton : SkeletonBase{
		public AnimationState state;
		public float TimeScale = 1.0f;

		public Skeleton(SkeletonData data, AnimationStateData stateData = null) : base(data) {
			Bone.setYDown(true);
			state = new AnimationState(stateData);
		}

		public override void update(float deltaTime) {
			base.update(deltaTime);
			state.update(deltaTime * TimeScale);
			state.apply(this);
			updateWorldTransform();
		}

		public void draw() {
			for (int i = 0; i < slots.Count(); ++i)
				if (slots[i].attachment != null) slots[i].attachment.draw(slots[i]);
		}
	}
}
